# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>
# Contributor: Francois Boulogne <devel at sciunto dot org>

pkgname=mat2
pkgver=0.13.3
pkgrel=2
pkgdesc='Metadata removal tool, supporting a wide range of commonly used file formats'
url='https://0xacab.org/jvoisin/mat2'
arch=('any')
license=('LGPL3')
depends=('python' 'python-mutagen' 'python-cairo' 'python-gobject' 'gdk-pixbuf2' 'poppler-glib' 'librsvg' 'perl-image-exiftool' 'mailcap')
makedepends=('python-setuptools')
optdepends=(
  'ffmpeg: video support'
  'bubblewrap: sandboxing support'
)
checkdepends=('ffmpeg')
source=(https://0xacab.org/jvoisin/mat2/-/archive/${pkgver}/mat2-${pkgver}.tar.gz
        https://0xacab.org/jvoisin/mat2/uploads/672c73a1b8b0e79cdf7187900f3cc8ca/mat2-0.13.3.tar.gz.asc
        https://0xacab.org/jvoisin/mat2/-/commit/ed0ffa5693b6d710b19a9101d6cb0625f8b6f1fc.patch
        mat2-fix-tests.patch::https://0xacab.org/jvoisin/mat2/-/commit/daa17a3e9c3e7ac5a97e7c7ab10a382abd7d7562.patch)
sha512sums=('48405de214b69e6d6fe818580ce758817632a4a3ab6cc6b73e7c13d0db2d5cd75a4ffffab22ce1b5dc73a6cc03da9436e44e290f74700027277ec18db023a6fb'
            'SKIP'
            '2871800a28883c40a7779498692fea480f6e75f8412db3269494b62170a6d0439c109c857a52b33270596b2e3e9f0716c18ed16cde0533944acacaea501376c9'
            'f6f655ce864be3d6a5a79a45d0a3300f858ea16ecfce9721454a9c9e459d5aed605a2920bbe10db4c8882df107589acc852719122cb2f36ec894e34250dd060c')
b2sums=('26ace57f5ac8ba2444a389615cb89f30e27a89f2e704620dcf0e0999f9643d7b46f6a920ead1ee747c1ac7f818cdb3fe0dcd3acf3b370545414aefd7e1c3850c'
        'SKIP'
        '6e55c1be6d401860703267232e423de4cff2cc9141f0d058979d0f1aace08e4636b59e948c8dec1f5e8011f5299c503f091038466f661baf3dba8b75281e55de'
        '6f0a2c0bab32758d4b472b37e6a6e6ad740ca5f2af0ecd1b31fcfcb662cbb8d07b56c6f6505f977f362d8b147d719a923f0276aa072a027d792fb11a4faac374')

validpgpkeys=('9FCDEE9E1A381F311EA62A7404D041E8171901CC') # Julien (jvoisin) Voisin

prepare() {
  cd ${pkgname}-${pkgver}
  patch -i ../ed0ffa5693b6d710b19a9101d6cb0625f8b6f1fc.patch
  patch --forward --strip=1 --input=../mat2-fix-tests.patch
}

build() {
  cd ${pkgname}-${pkgver}
  python setup.py build
}

check() {
  cd ${pkgname}-${pkgver}
  python -m unittest discover -v
}

package() {
  cd ${pkgname}-${pkgver}
  python setup.py install --skip-build -O1 --root="${pkgdir}"
  install -Dm 644 dolphin/mat2.desktop -t "${pkgdir}/usr/share/kservices5/ServiceMenus"
  install -Dm 644 doc/mat2.1 -t "${pkgdir}/usr/share/man/man1"
  install -Dm 644 doc/*.md -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
